
/*-------------------------------------------------------------------------
 *
 * pg_user_mapping.h
 *	  "用户映射" 系统目录 (pg_user_mapping) 的定义
 *
 * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/include/catalog/pg_user_mapping.h
 *
 * NOTES
 *	  Catalog.pm 模块读取此文件并派生模式
 *	  信息。
 *
 *-------------------------------------------------------------------------
 */
#ifndef PG_USER_MAPPING_H
#define PG_USER_MAPPING_H

#include "catalog/genbki.h"
#include "catalog/pg_user_mapping_d.h"

/* ----------------
 *		pg_user_mapping 定义。 cpp 将其转换为
 *		typedef struct FormData_pg_user_mapping
 * ----------------
 */
CATALOG(pg_user_mapping,1418,UserMappingRelationId)
{
	Oid			oid;			/* oid */

	Oid			umuser BKI_LOOKUP_OPT(pg_authid);	/* 用户的 ID，
													 * 如果希望为 PUBLIC，则为 InvalidOid */
	Oid			umserver BKI_LOOKUP(pg_foreign_server); /* 此映射的服务器 */

#ifdef CATALOG_VARLEN			/* 可变长度字段从这里开始 */
	text		umoptions[1];	/* 用户映射选项 */
#endif
} FormData_pg_user_mapping;

/* ----------------
 *		Form_pg_user_mapping 对应指向具有 pg_user_mapping 关系格式的元组的指针。
 * ----------------
 */
typedef FormData_pg_user_mapping *Form_pg_user_mapping;

DECLARE_TOAST(pg_user_mapping, 4173, 4174);

DECLARE_UNIQUE_INDEX_PKEY(pg_user_mapping_oid_index, 174, UserMappingOidIndexId, on pg_user_mapping using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_user_mapping_user_server_index, 175, UserMappingUserServerIndexId, on pg_user_mapping using btree(umuser oid_ops, umserver oid_ops));

#endif							/* PG_USER_MAPPING_H */
